// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   MsgFormBean.java

package com.vandagroup.common.msg;

import com.vandagroup.common.bo.UserContext;
import com.vandagroup.common.exp.TransException;
import com.vandagroup.common.msgexchange.EBankResult;
import com.vandagroup.common.util.Paras;
import java.util.Enumeration;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.struts.validator.ValidatorForm;

// Referenced classes of package com.vandagroup.common.msg:
//            MsgConfigInfo, MsgPro

public class MsgFormBean extends ValidatorForm
{

    private String msgCode;
    private HashMap mcpUpInfo;
    private Integer pageNO;
    protected String lastTransCode;
    private HttpServletRequest request;

    public UserContext getUser()
    {
        String _$isLogin = request.getParameter("_$isLogin");
        _$isLogin = _$isLogin == null ? "" : _$isLogin;
        HttpSession session = request.getSession(false);
        UserContext user = null;
        try
        {
            user = (UserContext)session.getAttribute(Paras.get("session"));
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        return user;
    }

    public HttpServletRequest getRequest()
    {
        return request;
    }

    public MsgFormBean()
    {
        msgCode = null;
        mcpUpInfo = null;
        pageNO = new Integer(1);
        lastTransCode = "";
        request = null;
    }

    public void setFstRow(String fstRow)
    {
        if(mcpUpInfo == null)
        {
            return;
        } else
        {
            mcpUpInfo.put("FSTROW", fstRow);
            return;
        }
    }

    public String getTransCode()
        throws Exception
    {
        return MsgConfigInfo.getTransCode(msgCode);
    }

    public int getTransCount()
        throws Exception
    {
        return MsgConfigInfo.getTransCount(msgCode);
    }

    public void loadRequest(HttpServletRequest request)
        throws Exception
    {
        Enumeration el = request.getParameterNames();
        mcpUpInfo = new HashMap();
        String key;
        for(; el.hasMoreElements(); mcpUpInfo.put(key, request.getParameter(key)))
            key = el.nextElement().toString().toUpperCase();

        this.request = request;
    }

    public HashMap getMcpUpInfo()
    {
        return mcpUpInfo;
    }

    public void setMcpUpInfo(HashMap mcpUpInfo)
    {
        this.mcpUpInfo = mcpUpInfo;
    }

    public String getMsgCode()
    {
        return msgCode;
    }

    public void setMsgCode(String msgCode)
    {
        this.msgCode = msgCode;
    }

    public Integer getPageNO()
    {
        return pageNO;
    }

    public void setPageNO(Integer pageNO)
    {
        this.pageNO = pageNO;
    }

    public EBankResult sendMCP()
        throws TransException, Exception
    {
        return (new MsgPro()).exchangeMsg(this);
    }

    public String getLastTransCode()
    {
        return lastTransCode;
    }

    public void setLastTransCode(String lastTransCode)
    {
        this.lastTransCode = lastTransCode;
    }

    public Object get(Object key)
    {
        if(mcpUpInfo == null)
            return null;
        else
            return mcpUpInfo.get(key);
    }

    public void put(Object key, Object value)
    {
        if(mcpUpInfo == null)
            mcpUpInfo = new HashMap();
        mcpUpInfo.put(key, value);
    }
}
